<template>
    <div class="flex-center demo-type">
        <el-row :gutter="20">
            <el-col :span="8">
                <div class="grid-content">

                </div>
            </el-col>
            <el-col :span="8">
                <div class="grid-content container">
                    <input type="text" v-model="keyword"><button icon="el-icon-search">搜索</button>
                </div>
            </el-col>
            <el-col :span="8">
                <div class="grid-content container">
                    <el-avatar icon="el-icon-user-solid"></el-avatar>
                     <el-dropdown>
                        <span class="el-dropdown-link">
                            <i class="el-icon-arrow-down el-icon--right"></i>
                        </span>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item icon="el-icon-key"><span @click="dialogVisible = true">登录</span></el-dropdown-item>
                            <el-dropdown-item icon="el-icon-switch-button">退出</el-dropdown-item>
                            <el-dropdown-item icon="el-icon-s-custom"><el-link href="http://localhost:8080/home" target="_blank">用户中心</el-link></el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </div>
            </el-col>
        </el-row>
        <el-dialog
            title="提示"
            :visible.sync="dialogVisible"
            width="30%">
            <el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
                <el-form-item
                    prop="email"
                    label="账号"
                    :rules="[
                    { required: true, message: '请输入邮箱地址', trigger: 'blur' },
                    { type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
                    ]"
                >
                    <el-input v-model="ruleForm.email" placeholder="请输入您注册时的邮箱"></el-input>
                </el-form-item>
                <el-form-item label="密码" prop="pass">
                    <el-input type="password" v-model="ruleForm.pass" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="submitForm('ruleForm')">登录</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
        
        
    </div>
</template>

<script>
export default {
    name:"search",
    data(){
      var validatePass = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请输入密码'));
        } else {
          if (this.ruleForm.checkPass !== '') {
            this.$refs.ruleForm.validateField('checkPass');
          }
          callback();
        }
      };
        return{
            keyword:'',
            dialogVisible: false,
            ruleForm: {
                pass: '',
                domains: [{
                    value: ''
                }],
                email: ''
            },
            rules: {
                pass: [
                    { validator: validatePass, trigger: 'blur' }
                ]
            }
            
        }
    }
}
</script>

<style scoped>
    .el-row {
      margin-bottom: 20px;
    }
    .el-row:last-child {
      margin-bottom: 0;
    }
    .el-col {
        border-radius: 4px;
    }
    .bg-purple-dark {
        background: #f7f8f9;
    }
    .bg-purple {
        background: #d3dce6;
    }
    .bg-purple-light {
        background: #e5e9f2;
    }
    .grid-content {
        border-radius: 4px;
        min-height: 36px;
    }
    .row-bg {
        padding: 10px 0;
        background-color: #f9fafc;
    }
     .container {
      display: flex;
      justify-content: center; /* 水平居中对齐 */
      align-items: center; /* 垂直居中对齐 */
    }
</style>